package people;

import gate.Key;
import gate.SimpleDoor;

/**
 * @Author buyee
 * @Date 2022/7/1 下午5:48
 */
public class Man implements ActionOnDoor {

    public String man;

    SimpleDoor simpleDoor;

    public Man(String man, SimpleDoor simpleDoor) {
        this.man = man;
        this.simpleDoor = simpleDoor;
    }

    @Override
    public void useKey(Key key) {
        open(key);
        across();
        close();
    }

    @Override
    public void open(Key key) {
        simpleDoor.canBeOpened(key);
    }

    @Override
    public void close() {
        simpleDoor.canBeClosed();
    }

    public void across() {
        simpleDoor.canBeAcross();
    }
}
